define(function(require){
	var $ = require("jquery");
	var justep = require("$UI/system/lib/justep");

	
	var Model = function(){
		this.readonly = justep.Bind.observable(false);
		this.callParent();
	};

	Model.prototype.modelLoad = function(event){
		var mode = this.getContext().getRequestParameter("mode");
		if(mode==='readonly'){
			this.readonly.set(true);
		}
	};

	Model.prototype.getSelected = function(){
		return this.comp('demoData').getCurrentRow();
	};
	
	Model.prototype.queryBtnClick = function(event){
		this.comp('dlgQuery').open();
	};
	
	Model.prototype.delAllBtnClick = function(){
		var data = this.comp('demoData');
		justep.Util.confirm("是否确定清空数据集？",function(){
			data.deleteAllData({confirm:false});
		});
	};
	
	Model.prototype.toUrl = function(url){
		return require.toUrl(url);
	};

	return Model;
});